/**
 * Created by fplei on 2018/11/28.
 */
function addClass(element, className) {
    if(!new RegExp("(^|\\s)" + className + "(\\s|$)").test(element.className)) element.className += ' ' + className;
}
function removeClass(element, className) {
    element.className = element.className.replace(new RegExp("(^|\\s)" + className + "(?=(\\s|$))", "g"), '');
}
function topBarMove(index) {
    var dc=document.getElementById("navbar-ul");
    var childCount=dc.childElementCount;
    for(var i=1;i<=childCount;i++){
        var childItem=document.getElementById("item"+i);
        if(index==i){
            addClass(childItem,"active")
        }else {
            removeClass(childItem,"active")
        }
    }
}